<!DOCTYPE html>
<html lang="en">
    <head>
        
        {include file="public/header"}
        <link href="/admin/vendor/datePicker/bootstrap-datepicker.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="/admin/vendor/ue/ueditor.config.js"></script>
        
        <script type="text/javascript" src="/admin/vendor/ue/ueditor.all.js"></script>
        <meta name="description" content="">
        <title>{$data.art_title}</title>
    </head>
    <body>
        <div class="wrapper">
            {include file="public/nav"}  
            <div id="page-wrapper" style="min-height: 325px;">
                <div class="row">
	                <div class="col-lg-12">
	                    <h1 class="page-header">编辑文章</h1>
	                </div>
	                <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->

                <div class="row">
                    <form class="form" role="form" action="update" method="post">
                        <input type="hidden" name="id" value="{$data.art_id}">
                        <Div class="col-lg-4">
                            <div class="form-group">
                                <label>选择分类</label>
                                <select class="form-control" name="cat_id">
                                    {volist name="cat_data" id="vcat"}
                                    {php} if($data['art_cat_id'] == $vcat['cat_id']){{/php}
                                    <option value="{$vcat.cat_id}" selected>{$vcat.cat_name}</option>
                                    
                                    {php}continue;}{/php}
                                    <option value="{$vcat.cat_id}" >{$vcat.cat_name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <div class="col-lg-6">
                            <div class="form-group">
                                <label>文章标题</label>
                                <input class="form-control" type="text" name="title" value="{$data.art_title}">
                                <p class="help-block">输入少于30个中文字体的标题</p>
                            </div>
                            <div class="form-group">
                                <label>文章副标题</label>
                                <input class="form-control" type="text" name="nick_title" value="{$data.art_nicktitle}">
                                <p class="help-block">文章副标题，少于30个字</p>
                            </div>
                            <div class="form-group">
                                <label>文章作者</label>
                                <input class="form-control" type="text" name="author" value="{$data.art_author}">
                                <p class="help-block">作者名字最多6个中文字符</p>
                            </div>                            
                            <div class="form-group">
                                <div class="form-group">
                                    <label>文章属性</label>
                                    <label class="checkbox-inline">
                                        <input type="checkbox" name="art_type"  {php}if($data['art_type'] ==0 ) echo "checked"; {/php} value="0">一般
                                    </label>
                                    <label class="checkbox-inline">
                                        <input type="checkbox"  name="art_type" {php}if($data['art_type'] ==1 ) echo "checked"; {/php} value="1">头条
                                    </label>
                                </div>
                                <div class="form-group">
                                    <label>文章来源</label>
                                    <input class="form-control" type="text" name="article_source" value="{$data.art_source}">
                                    <p class="help-block">可以填写网址</p>
                                </div>
                                
                            </div>
                            <div class="form-group">
                                <label>是否审核</label>
                                <label class="radio-inline">
                                    <input type="radio" name="is_check" id="is_check" value="0" {php}if($data['art_ischeck'] ==0 ) echo "checked"; {/php}>是
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" name="is_check" id="is_check" value="1" {php}if($data['art_ischeck'] ==1 ) echo "checked"; {/php}>否
                                </label>
                            </div>
                            <div class="form-group">
                                <label>排序</label>
                                <input class="form-control" type="text" name="art_order" value="{$data.art_order}">
                                <p class="help-block">数字越小越在前面</p>
                            </div>
                            <div class="form-group">
                                <label>选择时间</label>
                                <input id="date-picker" class="form-control" type="text" name="date" readonly="readonly" id="date" value="{$data.art_create_time}">
                            </div>
                        </div>
                        <div class="col-lg-10">
                            <div class="form-group">
                                <label>简介内容</label>
                                <textarea name="disc" class="form-control">{$data.art_disc}</textarea>
                            </div>
                        </div>
                        <div class="col-lg-12">
                            <div class="form-group">
                                <label>详细内容</label>
                                <script id="editor" type="text/plain">{$data.art_content}</script>                                    
                                <textarea id="content" name="content" style="display:none"></textarea>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <div class="col-lg-12">
                            <a href="javascript:;" id="submit" class="btn btn-primary">确定</a>
                        </div>
                    </form>
                </div>
            </div>
            {include file="public/default-modal"}
        </div>
        {include file="public/javascript"}
        <script type="text/javascript" src="/admin/vendor/datePicker/bootstrap-datepicker.js"></script>
        <script type="text/javascript">
         
         var ue = UE.getEditor('editor');
         $("#submit").on('click',function(){
             $data = $("form").serialize();
             $modal = $("#default-modal");
             $body = $modal.find(".modal-body")
             $.ajax({
                 url : "update.html",
                 type : "post",
                 data : $data,
                 dataType : "json",
                 success : function(res){
                     $body.text(res.msg);
                     $modal.modal("show");
                 },
                 error : function(){
                     $modal.test("system error");
                     $modal.modal("show");

                 }
             })
         });
        </script>
    </body>
</html>
